package com.example.avue.util;

public class ResResponse<T> {
    private final static String SUCCESS = "success";

    public static <T> ResResult<T> makeOKRsp() {
        return new ResResult<T>().setCode(ResCode.SUCCESS).setMsg(SUCCESS);
    }

    public static <T> ResResult<T> makeOKRsp(T data) {
        return new ResResult<T>().setCode(ResCode.SUCCESS).setMsg(SUCCESS).setSuccess(true).setData(data);
    }

    public static <T> ResResult<T> makeErrRsp(String message) {
        return new ResResult<T>().setCode(ResCode.FAIL).setMsg(SUCCESS);
    }

    public static <T> ResResult<T> makeRsp(int code, String msg) {
        return new ResResult<T>().setCode(code).setMsg(msg);
    }

    public static <T> ResResult<T> makeRsp(int code, String msg, T data) {
        return new ResResult<T>().setCode(code).setMsg(msg).setData(data);
    }
}
